using System;
using System.Linq;
using System.Data;
using System.Data.Odbc;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Reviewer.Business;
using Reviewer.Entities.Services;
using Reviewer.Entities;

public partial class Videoplayer : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            using (IGameVideoService service = ServiceFactory.GameVideoService)
            using (IGameService gameService = ServiceFactory.GameService)
            {
                GameVideo video = service.FindBy(int.Parse(Request["Id"]));
                Game game = gameService.GetBy(video.GameId).FirstOrDefault();

                divVideo.InnerHtml = "<center>";
                divVideo.InnerHtml += "<OBJECT ID=\"MediaPlayer\" width=590 height=580 classid=\"CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95\" codebase=\"http://activex.microsoft.com/activex/controls/ mplayer/en/nsmp2inf.cab#Version=5,1,52,701\" standby= \"Loading Media Player\" type=\"application/first-oleobject\">";
                //Old CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95 - New CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6.
                divVideo.InnerHtml += "<PARAM NAME=\"FileName\" VALUE=\"" + video.Link + "\">";
                divVideo.InnerHtml += "<PARAM NAME=\"AutoStart\" VALUE=\"True\">";
                divVideo.InnerHtml += "<PARAM NAME=\"ShowControls\" VALUE=\"True\">";
                divVideo.InnerHtml += "<PARAM NAME=\"ShowStatusBar\" VALUE=\"True\">";
                divVideo.InnerHtml += "<PARAM NAME=\"STANDBY\" VALUE=\"Reviewer.dk\">";
                divVideo.InnerHtml += "<EMBED type=\"application/first-mplayer2\" pluginspage=\"http://www.microsoft.com/Windows/MediaPlayer/\" SRC=\"" + video.Link + "\" width=580 height=570 name=\"MediaPlayer\" AutoStart=1 ShowStatusBar=1 ShowControls=1 >";
                divVideo.InnerHtml += "</EMBED></OBJECT></center>";

                lblSpilTitel.Text = game.Title;
                lblSpilDesc.Text = video.Text;
                this.Title = "Spil Video: " + game.Title;
            }
        }
    }
}
